package GOrden.mobile;

import java.util.List;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class AdaptadorOrdenes extends ArrayAdapter {
	private final Activity context;
	private final List<Ordenes> datos;

	@SuppressWarnings("unchecked")
	AdaptadorOrdenes(Activity context, List<Ordenes> objects) {
		super(context, R.layout.list_orden_item, objects);
		this.context = context;
		this.datos = objects;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = context.getLayoutInflater();
		View item = inflater.inflate(R.layout.list_orden_item, null);

		Ordenes actual = datos.get(position);
		TextView lbOrden = (TextView) item.findViewById(R.id.Orden);
		lbOrden.setText("Barrio: " + actual.getBarrio());

		TextView lbDireccion = (TextView) item.findViewById(R.id.Direccion);
		lbDireccion.setText(actual.getDireccion());

		TextView lbTipo = (TextView) item.findViewById(R.id.Tipo);
		lbTipo.setText(actual.getTipo());
		return (item);
	}
}